package edu.sctu.zhangwang.month201506.day20150605.test;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * Created by Administrator on 2015/6/5.
 */
public class DateUtil {

        private static DateUtil dateutil = null;
        private String string;

        public DateUtil(String string){
            this.string = string;
        }


        public static DateUtil getInstance(String string){
            if(dateutil == null){
                dateutil = new DateUtil(string);
            }
            return dateutil;
        }

        public void getDateTime(){
            Date date = new Date();
            System.out.println(date.getTime());
        }

        public void getNowDate() {

            SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            System.out.println(simple.format(new Date()));
        }


        public void getCanlder(){
            Calendar calender = Calendar.getInstance();

            calender.add(Calendar.MONTH, +1);
            calender.add(Calendar.DAY_OF_MONTH, +28);
            calender.set(Calendar.MONTH, 9);
            System.out.println(calender.get(Calendar.YEAR));
            System.out.println(calender.get(Calendar.MONTH));
            System.out.println(calender.get(Calendar.DAY_OF_MONTH));
            System.out.println(calender.get(Calendar.HOUR_OF_DAY));
            System.out.println(calender.getTimeInMillis());
            System.out.println(calender.get(Calendar.MINUTE));
            System.out.println(calender.get(Calendar.SECOND));
        }

}
